/*    */ package com.zimbra.cs.service.mail;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.soap.MailConstants;
/*    */ import com.zimbra.cs.mailbox.MailServiceException;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.Note;
/*    */ import com.zimbra.cs.mailbox.OperationContext;
/*    */ import com.zimbra.cs.service.util.ItemId;
/*    */ import com.zimbra.cs.service.util.ItemIdFormatter;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class GetNote
/*    */   extends MailDocumentHandler
/*    */ {
/* 38 */   private static final String[] TARGET_NOTE_PATH = { "note", "id" };
/* 39 */   protected String[] getProxiedIdPath(Element request) { return TARGET_NOTE_PATH; }
/* 40 */   protected boolean checkMountpointProxy(Element request) { return false; }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context) throws ServiceException {
/* 43 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 44 */     Mailbox mbox = getRequestedMailbox(zsc);
/* 45 */     OperationContext octxt = getOperationContext(zsc, context);
/* 46 */     ItemIdFormatter ifmt = new ItemIdFormatter(zsc);
/*    */     
/* 48 */     Element enote = request.getElement("note");
/* 49 */     ItemId iid = new ItemId(enote.getAttribute("id"), zsc);
/*    */     
/* 51 */     Note note = mbox.getNoteById(octxt, iid.getId());
/*    */     
/* 53 */     if (note == null) {
/* 54 */       throw MailServiceException.NO_SUCH_NOTE(iid.getId());
/*    */     }
/* 56 */     Element response = zsc.createElement(MailConstants.GET_NOTE_RESPONSE);
/* 57 */     ToXML.encodeNote(response, ifmt, octxt, note);
/* 58 */     return response;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/mail/GetNote.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */